package handle

import (
	"fmt"

	"github.com/gofiber/fiber/v2"
)

func NewRedirect() Redirect {
	return Redirect{}
}

type Redirect struct {
}

func (r Redirect) InitRoute(server *fiber.App) {
	p := server.Group("/trans")
	p.Get("/redirect", r.Redirect())
	p.Get("/exec", r.Exec())
	p.Get("/serveHttpc", r.ServeHTTPC())
	p.Get("/default", r.Default())
}
func (r Redirect) Redirect() fiber.Handler {
	return func(ctx *fiber.Ctx) error {
		return ctx.Redirect("/trans/exec", 301)
	}
}
func (r Redirect) ServeHTTPC() fiber.Handler {
	return func(ctx *fiber.Ctx) error {
		return nil
	}
}
func (r Redirect) Exec() fiber.Handler {
	return func(ctx *fiber.Ctx) error {
		fmt.Println("Exec")
		return nil
	}
}
func (r Redirect) Default() fiber.Handler {
	return func(ctx *fiber.Ctx) error {
		fmt.Println("Default")
		return nil
	}
}
